#include <iostream>
using namespace std;


class Person
{
public:
    Person()
    {
        cout << "Person()" << endl;
    }

    virtual ~Person()
    {
        cout << "~Person()" << endl;
    }

    void run ()
    {
        cout << "Person::run()" << endl;
    }

private:
    int m_age;
};

class Student : public Person
{
public:
    Student()
    {
        m_score = new int[10];
        cout << "student()" << endl;
    }

    ~Student() override
    {
        delete m_score;
        cout << "~student()" << endl;
    }

    void run()
    {
        cout << "Student::run()" << endl;
    }

    void study()
    {
        cout << "Student::study()" << endl;
    }
private:
    int * m_score;
};


int main()
{
    const char* str = "hello world";
#if 0
    char * buffer = const_cast<char *>(str);
#elif 0
    /* 错误使用 */
    char* buffer = dynamic_cast<char*>(str);
#elif 1
    /* 非const 转 cosnt */
    char* buffer = const_cast<char *>(str);
    const char* buffer2 = static_cast<const char*>(buffer);
#endif
}